/**  
* @Title: WechatInstalmentOrderController.java
* @Package com.hjb.service.controller.Wechat
* @author <a href="mailto:125671254@qq.com">Pan Xinwen</a>panxinwen
* @date 2018年1月10日 下午11:41:20
* @version V1.0  
*/ 
package com.hjb.service.controller.Wechat;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.hjb.service.Wechat.WechatInstalmentOrderService;
import com.hjb.service.annotation.LogInfo;
import com.hjb.service.annotation.LogType;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
* @ClassName: WechatBankCardController
* @Description: TODO(公众号端租户分期维护)
* @author <a href="mailto:125671254@qq.com">Pan Xinwen</a>panxinwen
* @date 2018年1月10日 下午11:41:20
*
*/
@RestController
@RequestMapping("/Wechat/instalment")
@Api(value="/Wechat/instalment",description="公众号端租户还款计划"	)
public class WechatInstalmentOrderController {
	
	@Autowired
	private WechatInstalmentOrderService wechatInstalmentOrderService;
	

	@SuppressWarnings("rawtypes")
	@LogInfo(logType=LogType.查询,operationContent="查询正在还款的计划")
	@PostMapping("/getInstalmentOrder")
	@ResponseBody
	@ApiOperation(value="查询正在还款的计划", notes="查询正在还款的计划")
	@ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "orderId", value = "合同单号", required = true)})
	public ResponseEntity getInstalmentOrder(@RequestParam(value = "orderId", required = true) String orderId){
		
		return ResponseEntity.ok(wechatInstalmentOrderService.getInstalmentOrder(orderId));
		
	}
	
	@SuppressWarnings("rawtypes")
	@LogInfo(logType=LogType.查询,operationContent="更新本期还款状态")
	@PostMapping("/updateOrderStatus")
	@ResponseBody
	@ApiOperation(value="更新本期还款状态", notes="更新本期还款状态")
	@ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "String", name = "orderId", value = "本期还款编号", required = false)})
	public ResponseEntity updateOrderStatus(@RequestParam(value = "orderId", required = false) String orderId){
		
		return ResponseEntity.ok(wechatInstalmentOrderService.updateOrderStatus(orderId,2));
		
	}
	
}
